package pyf;

/**
 * @author pengyifeng
 * @version 5.1
 * @ClassName ThreadJoinDemo.java
 * @Description join Demo
 * @createTime 2021年07月27日 09:44:00
 */
public class ThreadJoinDemo implements Runnable{
    @Override
    public void run() {
        System.out.println("vip插队");
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new ThreadJoinDemo());
        thread.start();
        for (int i = 0; i < 10; i++) {
            System.out.println("main开始排队到第"+i);
            if(5==i){
                thread.join();
            }
        }
    }
}
